#include "Outtextxy.h"

Outtextxy::Outtextxy(int x, int y, int width, int height, const std::wstring& text)
    : x(x), y(y), width(width), height(height), text(text) {}

Outtextxy::~Outtextxy() {}

/*const wstring& Outtextxy::getText() const
{
    return text;
}*/
void Outtextxy::setText(const std::wstring& newText)
{
    text = newText;
}
void Outtextxy::draw() {
    settextcolor(BLACK);
    setbkmode(TRANSPARENT);
    settextstyle(height * 0.8, 0, _T("宋体"));
    int textX = x + (width - textwidth(text.c_str())) / 2;
    int textY = y + (height - textheight(_T("宋体"))) / 2;
    outtextxy(textX, textY, text.c_str());
}